#include "sm4.h"

const char* sm4_file_names[] =
{
   "temp",
   "input",
   "output",
   "indexable_temp",
   "immediate32",
   "immediate64",
   "sampler",
   "resource",
   "constant_buffer",
   "immediate_constant_buffer",
   "label",
   "input_primitiveid",
   "output_depth",
   "null",
   "rasterizer",
   "output_coverage_mask",
   "stream",
   "function_body",
   "function_table",
   "interface",
   "function_input",
   "function_output",
   "output_control_point_id",
   "input_fork_instance_id",
   "input_join_instance_id",
   "input_control_point",
   "output_control_point",
   "input_patch_constant",
   "input_domain_point",
   "this_pointer",
   "unordered_access_view",
   "thread_group_shared_memory",
   "input_thread_id",
   "input_thread_group_id",
   "input_thread_id_in_group",
   "input_coverage_mask",
   "input_thread_id_in_group_flattened",
   "input_gs_instance_id",
   "output_depth_greater_equal",
   "output_depth_less_equal",
   "cycle_counter",
};

const char* sm4_operand_compnum_names[] =
{
   "0",
   "1",
   "4",
   "n",
   "",
};

const char* sm4_token_instruction_extended_type_names[] =
{
   "empty",
   "sample_controls",
   "resource_dim",
   "resource_return_type",
};

const char* sm4_interpolation_names[] =
{
   "undefined",
   "constant",
   "linear",
   "linear centroid",
   "linear noperspective",
   "linear noperspective centroid",
   "linear sample",
   "linear noperspective sample",
};

const char* sm4_operand_index_repr_names[] =
{
   "imm32",
   "imm64",
   "reg",
   "reg_imm32",
   "reg_imm64",
};

const char* sm4_sv_names[] =
{
   "undefined",
   "position",
   "clip_distance",
   "cull_distance",
   "render_target_array_index",
   "viewport_array_index",
   "vertex_id",
   "primitive_id",
   "instance_id",
   "is_front_face",
   "sample_index",
   "final_quad_u_eq_0_edge_tessfactor",
   "final_quad_v_eq_0_edge_tessfactor",
   "final_quad_u_eq_1_edge_tessfactor",
   "final_quad_v_eq_1_edge_tessfactor",
   "final_quad_u_inside_tessfactor",
   "final_quad_v_inside_tessfactor",
   "final_tri_u_eq_0_edge_tessfactor",
   "final_tri_v_eq_0_edge_tessfactor",
   "final_tri_w_eq_0_edge_tessfactor",
   "final_tri_inside_tessfactor",
   "final_line_detail_tessfactor",
   "final_line_density_tessfactor",
};

const char* sm4_token_operand_extended_type_names[] =
{
   "empty",
   "modifier",
};

const char* sm4_opcode_names[] =
{
   "add",
   "and",
   "break",
   "breakc",
   "call",
   "callc",
   "case",
   "continue",
   "continuec",
   "cut",
   "default",
   "deriv_rtx",
   "deriv_rty",
   "discard",
   "div",
   "dp2",
   "dp3",
   "dp4",
   "else",
   "emit",
   "emitthencut",
   "endif",
   "endloop",
   "endswitch",
   "eq",
   "exp",
   "frc",
   "ftoi",
   "ftou",
   "ge",
   "iadd",
   "if",
   "ieq",
   "ige",
   "ilt",
   "imad",
   "imax",
   "imin",
   "imul",
   "ine",
   "ineg",
   "ishl",
   "ishr",
   "itof",
   "label",
   "ld",
   "ldms",
   "log",
   "loop",
   "lt",
   "mad",
   "min",
   "max",
   "customdata",
   "mov",
   "movc",
   "mul",
   "ne",
   "nop",
   "not",
   "or",
   "resinfo",
   "ret",
   "retc",
   "round_ne",
   "round_ni",
   "round_pi",
   "round_z",
   "rsq",
   "sample",
   "sample_c",
   "sample_c_lz",
   "sample_l",
   "sample_d",
   "sample_b",
   "sqrt",
   "switch",
   "sincos",
   "udiv",
   "ult",
   "uge",
   "umul",
   "umad",
   "umax",
   "umin",
   "ushr",
   "utof",
   "xor",
   "dcl_resource",
   "dcl_constant_buffer",
   "dcl_sampler",
   "dcl_index_range",
   "dcl_gs_output_primitive_topology",
   "dcl_gs_input_primitive",
   "dcl_max_output_vertex_count",
   "dcl_input",
   "dcl_input_sgv",
   "dcl_input_siv",
   "dcl_input_ps",
   "dcl_input_ps_sgv",
   "dcl_input_ps_siv",
   "dcl_output",
   "dcl_output_sgv",
   "dcl_output_siv",
   "dcl_temps",
   "dcl_indexable_temp",
   "dcl_global_flags",
   "d3d10_count",
   "lod",
   "gather4",
   "sample_pos",
   "sample_info",
   "d3d10_1_count",
   "hs_decls",
   "hs_control_point_phase",
   "hs_fork_phase",
   "hs_join_phase",
   "emit_stream",
   "cut_stream",
   "emitthencut_stream",
   "fcall",
   "bufinfo",
   "deriv_rtx_coarse",
   "deriv_rtx_fine",
   "deriv_rty_coarse",
   "deriv_rty_fine",
   "gather4_c",
   "gather4_po",
   "gather4_po_c",
   "rcp",
   "f32tof16",
   "f16tof32",
   "uaddc",
   "usubb",
   "countbits",
   "firstbit_hi",
   "firstbit_lo",
   "firstbit_shi",
   "ubfe",
   "ibfe",
   "bfi",
   "bfrev",
   "swapc",
   "dcl_stream",
   "dcl_function_body",
   "dcl_function_table",
   "dcl_interface",
   "dcl_input_control_point_count",
   "dcl_output_control_point_count",
   "dcl_tess_domain",
   "dcl_tess_partitioning",
   "dcl_tess_output_primitive",
   "dcl_hs_max_tessfactor",
   "dcl_hs_fork_phase_instance_count",
   "dcl_hs_join_phase_instance_count",
   "dcl_thread_group",
   "dcl_unordered_access_view_typed",
   "dcl_unordered_access_view_raw",
   "dcl_unordered_access_view_structured",
   "dcl_thread_group_shared_memory_raw",
   "dcl_thread_group_shared_memory_structured",
   "dcl_resource_raw",
   "dcl_resource_structured",
   "ld_uav_typed",
   "store_uav_typed",
   "ld_raw",
   "store_raw",
   "ld_structured",
   "store_structured",
   "atomic_and",
   "atomic_or",
   "atomic_xor",
   "atomic_cmp_store",
   "atomic_iadd",
   "atomic_imax",
   "atomic_imin",
   "atomic_umax",
   "atomic_umin",
   "imm_atomic_alloc",
   "imm_atomic_consume",
   "imm_atomic_iadd",
   "imm_atomic_and",
   "imm_atomic_or",
   "imm_atomic_xor",
   "imm_atomic_exch",
   "imm_atomic_cmp_exch",
   "imm_atomic_imax",
   "imm_atomic_imin",
   "imm_atomic_umax",
   "imm_atomic_umin",
   "sync",
   "dadd",
   "dmax",
   "dmin",
   "dmul",
   "deq",
   "dge",
   "dlt",
   "dne",
   "dmov",
   "dmovc",
   "dtof",
   "ftod",
   "eval_snapped",
   "eval_sample_index",
   "eval_centroid",
   "dcl_gs_instance_count",
};

const sm4_opcode_type sm4_opcode_types[] =
{
   SM4_OPCODE_TYPE_FLOAT,   //   "add",
   SM4_OPCODE_TYPE_UINT,   // "and",
   SM4_OPCODE_TYPE_NA,   //   "break",
   SM4_OPCODE_TYPE_NA,   //   "breakc",
   SM4_OPCODE_TYPE_NA,   //   "call",
   SM4_OPCODE_TYPE_NA,   //   "callc",
   SM4_OPCODE_TYPE_NA,   //   "case",
   SM4_OPCODE_TYPE_NA,   //   "continue",
   SM4_OPCODE_TYPE_NA,   //   "continuec",
   SM4_OPCODE_TYPE_NA,   //   "cut",
   SM4_OPCODE_TYPE_NA,   //   "default",
   SM4_OPCODE_TYPE_NA,   //   "deriv_rtx",
   SM4_OPCODE_TYPE_NA,   //   "deriv_rty",
   SM4_OPCODE_TYPE_NA,   //   "discard",
   SM4_OPCODE_TYPE_FLOAT,   //   "div",
   SM4_OPCODE_TYPE_FLOAT,   //   "dp2",
   SM4_OPCODE_TYPE_FLOAT,   //   "dp3",
   SM4_OPCODE_TYPE_FLOAT,   //   "dp4",
   SM4_OPCODE_TYPE_NA,   //   "else",
   SM4_OPCODE_TYPE_NA,   //   "emit",
   SM4_OPCODE_TYPE_NA,   //   "emitthencut",
   SM4_OPCODE_TYPE_NA,   //   "endif",
   SM4_OPCODE_TYPE_NA,   //   "endloop",
   SM4_OPCODE_TYPE_NA,   //   "endswitch",
   SM4_OPCODE_TYPE_FLOAT,   //   "eq",
   SM4_OPCODE_TYPE_FLOAT,   //   "exp",
   SM4_OPCODE_TYPE_FLOAT,   //   "frc",
   SM4_OPCODE_TYPE_NA,   //   "ftoi",
   SM4_OPCODE_TYPE_NA,   //   "ftou",
   SM4_OPCODE_TYPE_FLOAT,   //   "ge",
   SM4_OPCODE_TYPE_INT,   //  "iadd",
   SM4_OPCODE_TYPE_NA,   //   "if",
   SM4_OPCODE_TYPE_INT,   //  "ieq",
   SM4_OPCODE_TYPE_INT,   //  "ige",
   SM4_OPCODE_TYPE_INT,   //  "ilt",
   SM4_OPCODE_TYPE_INT,   //  "imad",
   SM4_OPCODE_TYPE_INT,   //  "imax",
   SM4_OPCODE_TYPE_INT,   //  "imin",
   SM4_OPCODE_TYPE_INT,   //  "imul",
   SM4_OPCODE_TYPE_INT,   //  "ine",
   SM4_OPCODE_TYPE_INT,   //  "ineg",
   SM4_OPCODE_TYPE_INT,   //  "ishl",
   SM4_OPCODE_TYPE_INT,   //  "ishr",
   SM4_OPCODE_TYPE_NA,   //   "itof",
   SM4_OPCODE_TYPE_NA,   //   "label",
   SM4_OPCODE_TYPE_UINT,   // "ld",
   SM4_OPCODE_TYPE_UINT,   // "ldms",
   SM4_OPCODE_TYPE_FLOAT,   //   "log",
   SM4_OPCODE_TYPE_NA,   //   "loop",
   SM4_OPCODE_TYPE_FLOAT,   //   "lt",
   SM4_OPCODE_TYPE_FLOAT,   //   "mad",
   SM4_OPCODE_TYPE_FLOAT,   //   "min",
   SM4_OPCODE_TYPE_FLOAT,   //   "max",
   SM4_OPCODE_TYPE_NA,   //   "customdata",
   SM4_OPCODE_TYPE_FLOAT,   //   "mov",
   SM4_OPCODE_TYPE_FLOAT,   //   "movc",
   SM4_OPCODE_TYPE_FLOAT,   //   "mul",
   SM4_OPCODE_TYPE_FLOAT,   //   "ne",
   SM4_OPCODE_TYPE_NA,   //   "nop",
   SM4_OPCODE_TYPE_NA,   //   "not",
   SM4_OPCODE_TYPE_UINT,   // "or",
   SM4_OPCODE_TYPE_NA,   //   "resinfo",
   SM4_OPCODE_TYPE_NA,   //   "ret",
   SM4_OPCODE_TYPE_NA,   //   "retc",
   SM4_OPCODE_TYPE_FLOAT,   //   "round_ne",
   SM4_OPCODE_TYPE_FLOAT,   //   "round_ni",
   SM4_OPCODE_TYPE_FLOAT,   //   "round_pi",
   SM4_OPCODE_TYPE_FLOAT,   //   "round_z",
   SM4_OPCODE_TYPE_FLOAT,   //   "rsq",
   SM4_OPCODE_TYPE_NA,   //   "sample",
   SM4_OPCODE_TYPE_NA,   //   "sample_c",
   SM4_OPCODE_TYPE_NA,   //   "sample_c_lz",
   SM4_OPCODE_TYPE_NA,   //   "sample_l",
   SM4_OPCODE_TYPE_NA,   //   "sample_d",
   SM4_OPCODE_TYPE_NA,   //   "sample_b",
   SM4_OPCODE_TYPE_FLOAT,   //   "sqrt",
   SM4_OPCODE_TYPE_FLOAT,   //   "switch",
   SM4_OPCODE_TYPE_FLOAT,   //   "sincos",
   SM4_OPCODE_TYPE_UINT,   // "udiv",
   SM4_OPCODE_TYPE_UINT,   // "ult",
   SM4_OPCODE_TYPE_UINT,   // "uge",
   SM4_OPCODE_TYPE_UINT,   // "umul",
   SM4_OPCODE_TYPE_UINT,   // "umad",
   SM4_OPCODE_TYPE_UINT,   // "umax",
   SM4_OPCODE_TYPE_UINT,   // "umin",
   SM4_OPCODE_TYPE_UINT,   // "ushr",
   SM4_OPCODE_TYPE_NA,   //   "utof",
   SM4_OPCODE_TYPE_UINT,   // "xor",
   SM4_OPCODE_TYPE_NA,   //   "dcl_resource",
   SM4_OPCODE_TYPE_NA,   //   "dcl_constant_buffer",
   SM4_OPCODE_TYPE_NA,   //   "dcl_sampler",
   SM4_OPCODE_TYPE_NA,   //   "dcl_index_range",
   SM4_OPCODE_TYPE_NA,   //   "dcl_gs_output_primitive_topology",
   SM4_OPCODE_TYPE_NA,   //   "dcl_gs_input_primitive",
   SM4_OPCODE_TYPE_NA,   //   "dcl_max_output_vertex_count",
   SM4_OPCODE_TYPE_NA,   //   "dcl_input",
   SM4_OPCODE_TYPE_NA,   //   "dcl_input_sgv",
   SM4_OPCODE_TYPE_NA,   //   "dcl_input_siv",
   SM4_OPCODE_TYPE_NA,   //   "dcl_input_ps",
   SM4_OPCODE_TYPE_NA,   //   "dcl_input_ps_sgv",
   SM4_OPCODE_TYPE_NA,   //   "dcl_input_ps_siv",
   SM4_OPCODE_TYPE_NA,   //   "dcl_output",
   SM4_OPCODE_TYPE_NA,   //   "dcl_output_sgv",
   SM4_OPCODE_TYPE_NA,   //   "dcl_output_siv",
   SM4_OPCODE_TYPE_NA,   //   "dcl_temps",
   SM4_OPCODE_TYPE_NA,   //   "dcl_indexable_temp",
   SM4_OPCODE_TYPE_NA,   //   "dcl_global_flags",
   SM4_OPCODE_TYPE_NA,   //   "d3d10_count",
   SM4_OPCODE_TYPE_NA,   //   "lod",
   SM4_OPCODE_TYPE_NA,   //   "gather4",
   SM4_OPCODE_TYPE_NA,   //   "sample_pos",
   SM4_OPCODE_TYPE_NA,   //   "sample_info",
   SM4_OPCODE_TYPE_NA,   //   "d3d10_1_count",
   SM4_OPCODE_TYPE_NA,   //   "hs_decls",
   SM4_OPCODE_TYPE_NA,   //   "hs_control_point_phase",
   SM4_OPCODE_TYPE_NA,   //   "hs_fork_phase",
   SM4_OPCODE_TYPE_NA,   //   "hs_join_phase",
   SM4_OPCODE_TYPE_NA,   //   "emit_stream",
   SM4_OPCODE_TYPE_NA,   //   "cut_stream",
   SM4_OPCODE_TYPE_NA,   //   "emitthencut_stream",
   SM4_OPCODE_TYPE_NA,   //   "interface_call",
   SM4_OPCODE_TYPE_NA,   //   "bufinfo",
   SM4_OPCODE_TYPE_NA,   //   "deriv_rtx_coarse",
   SM4_OPCODE_TYPE_NA,   //   "deriv_rtx_fine",
   SM4_OPCODE_TYPE_NA,   //   "deriv_rty_coarse",
   SM4_OPCODE_TYPE_NA,   //   "deriv_rty_fine",
   SM4_OPCODE_TYPE_NA,   //   "gather4_c",
   SM4_OPCODE_TYPE_NA,   //   "gather4_po",
   SM4_OPCODE_TYPE_NA,   //   "gather4_po_c",
   SM4_OPCODE_TYPE_NA,   //   "rcp",
   SM4_OPCODE_TYPE_FLOAT,   //   "f32tof16",
   SM4_OPCODE_TYPE_FLOAT,   //   "f16tof32",
   SM4_OPCODE_TYPE_UINT,   // "uaddc",
   SM4_OPCODE_TYPE_UINT,   // "usubb",
   SM4_OPCODE_TYPE_UINT,   // "countbits",
   SM4_OPCODE_TYPE_UINT,   // "firstbit_hi",
   SM4_OPCODE_TYPE_UINT,   // "firstbit_lo",
   SM4_OPCODE_TYPE_UINT,   // "firstbit_shi",
   SM4_OPCODE_TYPE_UINT,   // "ubfe",
   SM4_OPCODE_TYPE_INT,   //  "ibfe",
   SM4_OPCODE_TYPE_UINT,   // "bfi",
   SM4_OPCODE_TYPE_NA,   //   "bfrev",
   SM4_OPCODE_TYPE_NA,   //   "swapc",
   SM4_OPCODE_TYPE_NA,   //   "dcl_stream",
   SM4_OPCODE_TYPE_NA,   //   "dcl_function_body",
   SM4_OPCODE_TYPE_NA,   //   "dcl_function_table",
   SM4_OPCODE_TYPE_NA,   //   "dcl_interface",
   SM4_OPCODE_TYPE_NA,   //   "dcl_input_control_point_count",
   SM4_OPCODE_TYPE_NA,   //   "dcl_output_control_point_count",
   SM4_OPCODE_TYPE_NA,   //   "dcl_tess_domain",
   SM4_OPCODE_TYPE_NA,   //   "dcl_tess_partitioning",
   SM4_OPCODE_TYPE_NA,   //   "dcl_tess_output_primitive",
   SM4_OPCODE_TYPE_NA,   //   "dcl_hs_max_tessfactor",
   SM4_OPCODE_TYPE_NA,   //   "dcl_hs_fork_phase_instance_count",
   SM4_OPCODE_TYPE_NA,   //   "dcl_hs_join_phase_instance_count",
   SM4_OPCODE_TYPE_NA,   //   "dcl_thread_group",
   SM4_OPCODE_TYPE_NA,   //   "dcl_unordered_access_view_typed",
   SM4_OPCODE_TYPE_NA,   //   "dcl_unordered_access_view_raw",
   SM4_OPCODE_TYPE_NA,   //   "dcl_unordered_access_view_structured",
   SM4_OPCODE_TYPE_NA,   //   "dcl_thread_group_shared_memory_raw",
   SM4_OPCODE_TYPE_NA,   //   "dcl_thread_group_shared_memory_structured",
   SM4_OPCODE_TYPE_NA,   //   "dcl_resource_raw",
   SM4_OPCODE_TYPE_NA,   //   "dcl_resource_structured",
   SM4_OPCODE_TYPE_NA,   //   "ld_uav_typed",
   SM4_OPCODE_TYPE_NA,   //   "store_uav_typed",
   SM4_OPCODE_TYPE_NA,   //   "ld_raw",
   SM4_OPCODE_TYPE_NA,   //   "store_raw",
   SM4_OPCODE_TYPE_NA,   //   "ld_structured",
   SM4_OPCODE_TYPE_NA,   //   "store_structured",
   SM4_OPCODE_TYPE_UINT,   // "atomic_and",
   SM4_OPCODE_TYPE_UINT,   // "atomic_or",
   SM4_OPCODE_TYPE_UINT,   // "atomic_xor",
   SM4_OPCODE_TYPE_NA,   //   "atomic_cmp_store",
   SM4_OPCODE_TYPE_INT,   //  "atomic_iadd",
   SM4_OPCODE_TYPE_INT,   //  "atomic_imax",
   SM4_OPCODE_TYPE_INT,   //  "atomic_imin",
   SM4_OPCODE_TYPE_UINT,   // "atomic_umax",
   SM4_OPCODE_TYPE_UINT,   // "atomic_umin",
   SM4_OPCODE_TYPE_NA,   //   "imm_atomic_alloc",
   SM4_OPCODE_TYPE_NA,   //   "imm_atomic_consume",
   SM4_OPCODE_TYPE_INT,   //  "imm_atomic_iadd",
   SM4_OPCODE_TYPE_UINT,   // "imm_atomic_and",
   SM4_OPCODE_TYPE_UINT,   // "imm_atomic_or",
   SM4_OPCODE_TYPE_UINT,   // "imm_atomic_xor",
   SM4_OPCODE_TYPE_NA,   //   "imm_atomic_exch",
   SM4_OPCODE_TYPE_NA,   //   "imm_atomic_cmp_exch",
   SM4_OPCODE_TYPE_INT,   //  "imm_atomic_imax",
   SM4_OPCODE_TYPE_INT,   //  "imm_atomic_imin",
   SM4_OPCODE_TYPE_UINT,   // "imm_atomic_umax",
   SM4_OPCODE_TYPE_UINT,   // "imm_atomic_umin",
   SM4_OPCODE_TYPE_NA,   //   "sync",
   SM4_OPCODE_TYPE_DOUBLE,   //  "dadd",
   SM4_OPCODE_TYPE_DOUBLE,   //  "dmax",
   SM4_OPCODE_TYPE_DOUBLE,   //  "dmin",
   SM4_OPCODE_TYPE_DOUBLE,   //  "dmul",
   SM4_OPCODE_TYPE_DOUBLE,   //  "deq",
   SM4_OPCODE_TYPE_DOUBLE,   //  "dge",
   SM4_OPCODE_TYPE_DOUBLE,   //  "dlt",
   SM4_OPCODE_TYPE_DOUBLE,   //  "dne",
   SM4_OPCODE_TYPE_DOUBLE,   //  "dmov",
   SM4_OPCODE_TYPE_DOUBLE,   //  "dmovc",
   SM4_OPCODE_TYPE_NA,   //   "dtof",
   SM4_OPCODE_TYPE_NA,   //   "ftod",
   SM4_OPCODE_TYPE_NA,   //   "eval_snapped",
   SM4_OPCODE_TYPE_NA,   //   "eval_sample_index",
   SM4_OPCODE_TYPE_NA,   //   "eval_centroid",
   SM4_OPCODE_TYPE_NA,   //   "dcl_gs_instance_count",
}; 
   
const char* sm4_operand_mode_names[] =
{
   "mask",
   "swizzle",
   "scalar",
   "",
};

const char* sm4_target_names[] =
{
   "unknown",
   "buffer",
   "texture1d",
   "texture2d",
   "texture2dms",
   "texture3d",
   "texturecube",
   "texture1darray",
   "texture2darray",
   "texture2dmsarray",
   "texturecubearray",
   "raw_buffer",
   "structured_buffer",
};

const char* sm4_shortfile_names[] =
{
   "r",
   "v",
   "o",
   "x",
   "l",
   "d",
   "sampler",
   "resource",
   "cb",
   "icb",
   "label",
   "vPrim",
   "oDepth",
   "null",
   "rasterizer",
   "oMask",
   "stream",
   "function_body",
   "function_table",
   "interface",
   "function_input",
   "function_output",
   "vOutputControlPointID",
   "vForkInstanceID",
   "vJoinInstanceID",
   "vicp",
   "vocp",
   "input_patch_constant",
   "vDomain",
   "this",
   "u",
   "g",
   "vThreadID",
   "vThreadGrouID",
   "vThreadIDInGroup",
   "vCoverage",
   "vThreadIDInGroupFlattened",
   "vGSInstanceID",
   "oDepthGE",
   "oDepthLE",
   "vCycleCounter",
};

const char* sm4_primitive_names[] =
{
   "",
   "point",
   "line",
   "triangle",
   "",
   "",
   "line_adj",
   "triangle_adj",
};

const char* sm4_primitive_topology_names[] =
{
   "",
   "pointlist",
   "linelist",
   "linestrip",
   "trianglelist",
   "trianglestrip",
   "",
   "",
   "",
   "",
   "linelist_adj",
   "linestrip_adj",
   "trianglelist_adj",
   "trianglestrip_adj",
};
